<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta name="categories" content="JavaEE">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>获取RequestDispatcher的两种方法及区别</title>
</head>
<body>
	<div class="article-wrapper">
	<article>
		<h1 class="title">获取RequestDispatcher的两种方法及区别</h1>
		<hr />
		<section>
		<p>在SpringMVC应用或Struts应用，甚至是基本的Servlet应用中，在转发JSP的时候通常会用到如下方法：</p>
		<code>
			RequestDispatcher requestDispatcher = httpServletRequest.getRequestDispatcher("xxx.jsp");
			<br>requestDispatcher.forward(httpServletRequest, httpServletResponse);
		</code>
		<p style="color: red;">Note: Filter和Servlet中调用httpServletRequest.getRequestDispatcher的区别，以及调用以后是否还会走Filter。</p>
		<p>这种方式实际获取到的是一个根据请求URL匹配到的Servlet</p>
		</section>
	</article>
	</div>
</body>
</html>